from math import *

def main():

    D_INPUT = True


    if D_INPUT:
        func = raw_input()
        A,B = input()
    else:
        func = "tan(x)"
        A,B = -10,10

    fl_first = True
    for x in xrange(A,B+1):
        try:
            VAL = eval(func)

            if fl_first:
                MIN = VAL
                MAX = VAL
                fl_first = False
                continue

            if MIN > VAL : MIN = VAL
            if MAX < VAL : MAX = VAL

        except ValueError:
            continue

        except ZeroDivisionError:
            continue

    print MIN,MAX

main()
